home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / ScreenSavers / bundle / Source / ScreenSaver.m < prev   
Text File  |  1995-06-12  |  786b  |  47 lines

  1.  
  2. #import "ScreenSaver.h"
  3.  
  4. @implementation ScreenSaver
  5.  
  6. void runOneStep (DPSTimedEntry timedEntry, double timeNow, void *data);
  7.  
  8. -    startScreenSaver
  9. {
  10.     void    runOneStep();
  11.             
  12.     if( !timerRunning )
  13.     {
  14.         PShidecursor();
  15.         bouncingView = [[[[NXBundle bundleForClass: [self class]]
  16.             classNamed: "BouncingView"] alloc] init];
  17.         [bouncingView startScreenSaver];        
  18.         timer = DPSAddTimedEntry(1.0 / 15.0, &runOneStep, 
  19.             bouncingView, NX_BASETHRESHOLD);
  20.         timerRunning = YES;
  21.     }
  22.     
  23.     return self;
  24. }
  25.  
  26. -    stopScreenSaver
  27. {
  28.     if( timerRunning )
  29.     {
  30.         PSshowcursor();
  31.         DPSRemoveTimedEntry (timer);
  32.         timerRunning = NO;
  33.         [bouncingView stopScreenSaver];
  34.         [bouncingView free];
  35.     }
  36.         
  37.     return self;
  38. }
  39.  
  40. void runOneStep (DPSTimedEntry timedEntry, double timeNow, void *data)
  41. {
  42.     [(id)data step];
  43. }
  44.  
  45.  
  46. @end
  47.